// Copyright 2018-2021 Polyaxon, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/* tslint:disable */
/* eslint-disable */
/**
 * Polyaxon SDKs and REST API specification.
 * Polyaxon SDKs and REST API specification.
 *
 * The version of the OpenAPI document: 1.7.4
 * Contact: contact@polyaxon.com
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


import * as runtime from '../runtime';
import {
    RuntimeError,
    RuntimeErrorFromJSON,
    RuntimeErrorToJSON,
    V1EntityStageBodyRequest,
    V1EntityStageBodyRequestFromJSON,
    V1EntityStageBodyRequestToJSON,
    V1ListActivitiesResponse,
    V1ListActivitiesResponseFromJSON,
    V1ListActivitiesResponseToJSON,
    V1ListModelRegistriesResponse,
    V1ListModelRegistriesResponseFromJSON,
    V1ListModelRegistriesResponseToJSON,
    V1ListModelVersionsResponse,
    V1ListModelVersionsResponseFromJSON,
    V1ListModelVersionsResponseToJSON,
    V1ModelRegistry,
    V1ModelRegistryFromJSON,
    V1ModelRegistryToJSON,
    V1ModelRegistrySettings,
    V1ModelRegistrySettingsFromJSON,
    V1ModelRegistrySettingsToJSON,
    V1ModelVersion,
    V1ModelVersionFromJSON,
    V1ModelVersionToJSON,
    V1Stage,
    V1StageFromJSON,
    V1StageToJSON,
} from '../models';

export interface ArchiveModelRegistryRequest {
    owner: string;
    name: string;
}

export interface BookmarkModelRegistryRequest {
    owner: string;
    name: string;
}

export interface CreateModelRegistryRequest {
    owner: string;
    body: V1ModelRegistry;
}

export interface CreateModelVersionRequest {
    owner: string;
    model: string;
    body: V1ModelVersion;
}

export interface CreateModelVersionStageRequest {
    owner: string;
    entity: string;
    name: string;
    body: V1EntityStageBodyRequest;
}

export interface DeleteModelRegistryRequest {
    owner: string;
    name: string;
}

export interface DeleteModelVersionRequest {
    owner: string;
    entity: string;
    name: string;
}

export interface GetModelRegistryRequest {
    owner: string;
    name: string;
}

export interface GetModelRegistryActivitiesRequest {
    owner: string;
    name: string;
    offset?: number;
    limit?: number;
    sort?: string;
    query?: string;
    mode?: string;
}

export interface GetModelRegistrySettingsRequest {
    owner: string;
    name: string;
}

export interface GetModelVersionRequest {
    owner: string;
    entity: string;
    name: string;
}

export interface GetModelVersionStagesRequest {
    owner: string;
    entity: string;
    name: string;
}

export interface ListModelRegistriesRequest {
    owner: string;
    offset?: number;
    limit?: number;
    sort?: string;
    query?: string;
}

export interface ListModelRegistryNamesRequest {
    owner: string;
    offset?: number;
    limit?: number;
    sort?: string;
    query?: string;
}

export interface ListModelVersionNamesRequest {
    owner: string;
    name: string;
    offset?: number;
    limit?: number;
    sort?: string;
    query?: string;
    mode?: string;
}

export interface ListModelVersionsRequest {
    owner: string;
    name: string;
    offset?: number;
    limit?: number;
    sort?: string;
    query?: string;
    mode?: string;
}

export interface PatchModelRegistryRequest {
    owner: string;
    modelName: string;
    body: V1ModelRegistry;
}

export interface PatchModelRegistrySettingsRequest {
    owner: string;
    model: string;
    body: V1ModelRegistrySettings;
}

export interface PatchModelVersionRequest {
    owner: string;
    model: string;
    versionName: string;
    body: V1ModelVersion;
}

export interface RestoreModelRegistryRequest {
    owner: string;
    name: string;
}

export interface UnbookmarkModelRegistryRequest {
    owner: string;
    name: string;
}

export interface UpdateModelRegistryRequest {
    owner: string;
    modelName: string;
    body: V1ModelRegistry;
}

export interface UpdateModelRegistrySettingsRequest {
    owner: string;
    model: string;
    body: V1ModelRegistrySettings;
}

export interface UpdateModelVersionRequest {
    owner: string;
    model: string;
    versionName: string;
    body: V1ModelVersion;
}

/**
 * 
 */
export class ModelRegistryV1Api extends runtime.BaseAPI {

    /**
     * Archive registry model
     */
    async archiveModelRegistryRaw(requestParameters: ArchiveModelRegistryRequest): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling archiveModelRegistry.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling archiveModelRegistry.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{name}/archive`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Archive registry model
     */
    async archiveModelRegistry(requestParameters: ArchiveModelRegistryRequest): Promise<void> {
        await this.archiveModelRegistryRaw(requestParameters);
    }

    /**
     * Bookmark registry model
     */
    async bookmarkModelRegistryRaw(requestParameters: BookmarkModelRegistryRequest): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling bookmarkModelRegistry.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling bookmarkModelRegistry.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{name}/bookmark`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Bookmark registry model
     */
    async bookmarkModelRegistry(requestParameters: BookmarkModelRegistryRequest): Promise<void> {
        await this.bookmarkModelRegistryRaw(requestParameters);
    }

    /**
     * Create registry model
     */
    async createModelRegistryRaw(requestParameters: CreateModelRegistryRequest): Promise<runtime.ApiResponse<V1ModelRegistry>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling createModelRegistry.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createModelRegistry.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/create`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: V1ModelRegistryToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ModelRegistryFromJSON(jsonValue));
    }

    /**
     * Create registry model
     */
    async createModelRegistry(requestParameters: CreateModelRegistryRequest): Promise<V1ModelRegistry> {
        const response = await this.createModelRegistryRaw(requestParameters);
        return await response.value();
    }

    /**
     * Create model version
     */
    async createModelVersionRaw(requestParameters: CreateModelVersionRequest): Promise<runtime.ApiResponse<V1ModelVersion>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling createModelVersion.');
        }

        if (requestParameters.model === null || requestParameters.model === undefined) {
            throw new runtime.RequiredError('model','Required parameter requestParameters.model was null or undefined when calling createModelVersion.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createModelVersion.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{model}/versions`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"model"}}`, encodeURIComponent(String(requestParameters.model))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: V1ModelVersionToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ModelVersionFromJSON(jsonValue));
    }

    /**
     * Create model version
     */
    async createModelVersion(requestParameters: CreateModelVersionRequest): Promise<V1ModelVersion> {
        const response = await this.createModelVersionRaw(requestParameters);
        return await response.value();
    }

    /**
     * Create new model version stage
     */
    async createModelVersionStageRaw(requestParameters: CreateModelVersionStageRequest): Promise<runtime.ApiResponse<V1Stage>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling createModelVersionStage.');
        }

        if (requestParameters.entity === null || requestParameters.entity === undefined) {
            throw new runtime.RequiredError('entity','Required parameter requestParameters.entity was null or undefined when calling createModelVersionStage.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling createModelVersionStage.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createModelVersionStage.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{entity}/versions/{name}/stages`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"entity"}}`, encodeURIComponent(String(requestParameters.entity))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: V1EntityStageBodyRequestToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1StageFromJSON(jsonValue));
    }

    /**
     * Create new model version stage
     */
    async createModelVersionStage(requestParameters: CreateModelVersionStageRequest): Promise<V1Stage> {
        const response = await this.createModelVersionStageRaw(requestParameters);
        return await response.value();
    }

    /**
     * Delete registry model
     */
    async deleteModelRegistryRaw(requestParameters: DeleteModelRegistryRequest): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling deleteModelRegistry.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling deleteModelRegistry.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{name}`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Delete registry model
     */
    async deleteModelRegistry(requestParameters: DeleteModelRegistryRequest): Promise<void> {
        await this.deleteModelRegistryRaw(requestParameters);
    }

    /**
     * Delete model version
     */
    async deleteModelVersionRaw(requestParameters: DeleteModelVersionRequest): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling deleteModelVersion.');
        }

        if (requestParameters.entity === null || requestParameters.entity === undefined) {
            throw new runtime.RequiredError('entity','Required parameter requestParameters.entity was null or undefined when calling deleteModelVersion.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling deleteModelVersion.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{entity}/versions/{name}`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"entity"}}`, encodeURIComponent(String(requestParameters.entity))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Delete model version
     */
    async deleteModelVersion(requestParameters: DeleteModelVersionRequest): Promise<void> {
        await this.deleteModelVersionRaw(requestParameters);
    }

    /**
     * Get registry model
     */
    async getModelRegistryRaw(requestParameters: GetModelRegistryRequest): Promise<runtime.ApiResponse<V1ModelRegistry>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling getModelRegistry.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getModelRegistry.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{name}`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ModelRegistryFromJSON(jsonValue));
    }

    /**
     * Get registry model
     */
    async getModelRegistry(requestParameters: GetModelRegistryRequest): Promise<V1ModelRegistry> {
        const response = await this.getModelRegistryRaw(requestParameters);
        return await response.value();
    }

    /**
     * Get model activities
     */
    async getModelRegistryActivitiesRaw(requestParameters: GetModelRegistryActivitiesRequest): Promise<runtime.ApiResponse<V1ListActivitiesResponse>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling getModelRegistryActivities.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getModelRegistryActivities.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        if (requestParameters.offset !== undefined) {
            queryParameters['offset'] = requestParameters.offset;
        }

        if (requestParameters.limit !== undefined) {
            queryParameters['limit'] = requestParameters.limit;
        }

        if (requestParameters.sort !== undefined) {
            queryParameters['sort'] = requestParameters.sort;
        }

        if (requestParameters.query !== undefined) {
            queryParameters['query'] = requestParameters.query;
        }

        if (requestParameters.mode !== undefined) {
            queryParameters['mode'] = requestParameters.mode;
        }

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{name}/activities`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ListActivitiesResponseFromJSON(jsonValue));
    }

    /**
     * Get model activities
     */
    async getModelRegistryActivities(requestParameters: GetModelRegistryActivitiesRequest): Promise<V1ListActivitiesResponse> {
        const response = await this.getModelRegistryActivitiesRaw(requestParameters);
        return await response.value();
    }

    /**
     * Get registry model settings
     */
    async getModelRegistrySettingsRaw(requestParameters: GetModelRegistrySettingsRequest): Promise<runtime.ApiResponse<V1ModelRegistrySettings>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling getModelRegistrySettings.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getModelRegistrySettings.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{name}/settings`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ModelRegistrySettingsFromJSON(jsonValue));
    }

    /**
     * Get registry model settings
     */
    async getModelRegistrySettings(requestParameters: GetModelRegistrySettingsRequest): Promise<V1ModelRegistrySettings> {
        const response = await this.getModelRegistrySettingsRaw(requestParameters);
        return await response.value();
    }

    /**
     * Get model version
     */
    async getModelVersionRaw(requestParameters: GetModelVersionRequest): Promise<runtime.ApiResponse<V1ModelVersion>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling getModelVersion.');
        }

        if (requestParameters.entity === null || requestParameters.entity === undefined) {
            throw new runtime.RequiredError('entity','Required parameter requestParameters.entity was null or undefined when calling getModelVersion.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getModelVersion.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{entity}/versions/{name}`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"entity"}}`, encodeURIComponent(String(requestParameters.entity))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ModelVersionFromJSON(jsonValue));
    }

    /**
     * Get model version
     */
    async getModelVersion(requestParameters: GetModelVersionRequest): Promise<V1ModelVersion> {
        const response = await this.getModelVersionRaw(requestParameters);
        return await response.value();
    }

    /**
     * Get model version stages
     */
    async getModelVersionStagesRaw(requestParameters: GetModelVersionStagesRequest): Promise<runtime.ApiResponse<V1Stage>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling getModelVersionStages.');
        }

        if (requestParameters.entity === null || requestParameters.entity === undefined) {
            throw new runtime.RequiredError('entity','Required parameter requestParameters.entity was null or undefined when calling getModelVersionStages.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getModelVersionStages.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{entity}/versions/{name}/stages`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"entity"}}`, encodeURIComponent(String(requestParameters.entity))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1StageFromJSON(jsonValue));
    }

    /**
     * Get model version stages
     */
    async getModelVersionStages(requestParameters: GetModelVersionStagesRequest): Promise<V1Stage> {
        const response = await this.getModelVersionStagesRaw(requestParameters);
        return await response.value();
    }

    /**
     * List registry models
     */
    async listModelRegistriesRaw(requestParameters: ListModelRegistriesRequest): Promise<runtime.ApiResponse<V1ListModelRegistriesResponse>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling listModelRegistries.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        if (requestParameters.offset !== undefined) {
            queryParameters['offset'] = requestParameters.offset;
        }

        if (requestParameters.limit !== undefined) {
            queryParameters['limit'] = requestParameters.limit;
        }

        if (requestParameters.sort !== undefined) {
            queryParameters['sort'] = requestParameters.sort;
        }

        if (requestParameters.query !== undefined) {
            queryParameters['query'] = requestParameters.query;
        }

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/list`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ListModelRegistriesResponseFromJSON(jsonValue));
    }

    /**
     * List registry models
     */
    async listModelRegistries(requestParameters: ListModelRegistriesRequest): Promise<V1ListModelRegistriesResponse> {
        const response = await this.listModelRegistriesRaw(requestParameters);
        return await response.value();
    }

    /**
     * List registry model names
     */
    async listModelRegistryNamesRaw(requestParameters: ListModelRegistryNamesRequest): Promise<runtime.ApiResponse<V1ListModelRegistriesResponse>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling listModelRegistryNames.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        if (requestParameters.offset !== undefined) {
            queryParameters['offset'] = requestParameters.offset;
        }

        if (requestParameters.limit !== undefined) {
            queryParameters['limit'] = requestParameters.limit;
        }

        if (requestParameters.sort !== undefined) {
            queryParameters['sort'] = requestParameters.sort;
        }

        if (requestParameters.query !== undefined) {
            queryParameters['query'] = requestParameters.query;
        }

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/names`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ListModelRegistriesResponseFromJSON(jsonValue));
    }

    /**
     * List registry model names
     */
    async listModelRegistryNames(requestParameters: ListModelRegistryNamesRequest): Promise<V1ListModelRegistriesResponse> {
        const response = await this.listModelRegistryNamesRaw(requestParameters);
        return await response.value();
    }

    /**
     * List model versions names
     */
    async listModelVersionNamesRaw(requestParameters: ListModelVersionNamesRequest): Promise<runtime.ApiResponse<V1ListModelVersionsResponse>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling listModelVersionNames.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling listModelVersionNames.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        if (requestParameters.offset !== undefined) {
            queryParameters['offset'] = requestParameters.offset;
        }

        if (requestParameters.limit !== undefined) {
            queryParameters['limit'] = requestParameters.limit;
        }

        if (requestParameters.sort !== undefined) {
            queryParameters['sort'] = requestParameters.sort;
        }

        if (requestParameters.query !== undefined) {
            queryParameters['query'] = requestParameters.query;
        }

        if (requestParameters.mode !== undefined) {
            queryParameters['mode'] = requestParameters.mode;
        }

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{name}/versions/names`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ListModelVersionsResponseFromJSON(jsonValue));
    }

    /**
     * List model versions names
     */
    async listModelVersionNames(requestParameters: ListModelVersionNamesRequest): Promise<V1ListModelVersionsResponse> {
        const response = await this.listModelVersionNamesRaw(requestParameters);
        return await response.value();
    }

    /**
     * List model versions
     */
    async listModelVersionsRaw(requestParameters: ListModelVersionsRequest): Promise<runtime.ApiResponse<V1ListModelVersionsResponse>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling listModelVersions.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling listModelVersions.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        if (requestParameters.offset !== undefined) {
            queryParameters['offset'] = requestParameters.offset;
        }

        if (requestParameters.limit !== undefined) {
            queryParameters['limit'] = requestParameters.limit;
        }

        if (requestParameters.sort !== undefined) {
            queryParameters['sort'] = requestParameters.sort;
        }

        if (requestParameters.query !== undefined) {
            queryParameters['query'] = requestParameters.query;
        }

        if (requestParameters.mode !== undefined) {
            queryParameters['mode'] = requestParameters.mode;
        }

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{name}/versions`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ListModelVersionsResponseFromJSON(jsonValue));
    }

    /**
     * List model versions
     */
    async listModelVersions(requestParameters: ListModelVersionsRequest): Promise<V1ListModelVersionsResponse> {
        const response = await this.listModelVersionsRaw(requestParameters);
        return await response.value();
    }

    /**
     * Patch registry model
     */
    async patchModelRegistryRaw(requestParameters: PatchModelRegistryRequest): Promise<runtime.ApiResponse<V1ModelRegistry>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling patchModelRegistry.');
        }

        if (requestParameters.modelName === null || requestParameters.modelName === undefined) {
            throw new runtime.RequiredError('modelName','Required parameter requestParameters.modelName was null or undefined when calling patchModelRegistry.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling patchModelRegistry.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{model.name}`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"model.name"}}`, encodeURIComponent(String(requestParameters.modelName))),
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: V1ModelRegistryToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ModelRegistryFromJSON(jsonValue));
    }

    /**
     * Patch registry model
     */
    async patchModelRegistry(requestParameters: PatchModelRegistryRequest): Promise<V1ModelRegistry> {
        const response = await this.patchModelRegistryRaw(requestParameters);
        return await response.value();
    }

    /**
     * Patch registry model settings
     */
    async patchModelRegistrySettingsRaw(requestParameters: PatchModelRegistrySettingsRequest): Promise<runtime.ApiResponse<V1ModelRegistrySettings>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling patchModelRegistrySettings.');
        }

        if (requestParameters.model === null || requestParameters.model === undefined) {
            throw new runtime.RequiredError('model','Required parameter requestParameters.model was null or undefined when calling patchModelRegistrySettings.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling patchModelRegistrySettings.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{model}/settings`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"model"}}`, encodeURIComponent(String(requestParameters.model))),
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: V1ModelRegistrySettingsToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ModelRegistrySettingsFromJSON(jsonValue));
    }

    /**
     * Patch registry model settings
     */
    async patchModelRegistrySettings(requestParameters: PatchModelRegistrySettingsRequest): Promise<V1ModelRegistrySettings> {
        const response = await this.patchModelRegistrySettingsRaw(requestParameters);
        return await response.value();
    }

    /**
     * Patch model version
     */
    async patchModelVersionRaw(requestParameters: PatchModelVersionRequest): Promise<runtime.ApiResponse<V1ModelVersion>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling patchModelVersion.');
        }

        if (requestParameters.model === null || requestParameters.model === undefined) {
            throw new runtime.RequiredError('model','Required parameter requestParameters.model was null or undefined when calling patchModelVersion.');
        }

        if (requestParameters.versionName === null || requestParameters.versionName === undefined) {
            throw new runtime.RequiredError('versionName','Required parameter requestParameters.versionName was null or undefined when calling patchModelVersion.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling patchModelVersion.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{model}/versions/{version.name}`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"model"}}`, encodeURIComponent(String(requestParameters.model))).replace(`{${"version.name"}}`, encodeURIComponent(String(requestParameters.versionName))),
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: V1ModelVersionToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ModelVersionFromJSON(jsonValue));
    }

    /**
     * Patch model version
     */
    async patchModelVersion(requestParameters: PatchModelVersionRequest): Promise<V1ModelVersion> {
        const response = await this.patchModelVersionRaw(requestParameters);
        return await response.value();
    }

    /**
     * Restore registry model
     */
    async restoreModelRegistryRaw(requestParameters: RestoreModelRegistryRequest): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling restoreModelRegistry.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling restoreModelRegistry.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{name}/restore`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Restore registry model
     */
    async restoreModelRegistry(requestParameters: RestoreModelRegistryRequest): Promise<void> {
        await this.restoreModelRegistryRaw(requestParameters);
    }

    /**
     * Unbookmark registry model
     */
    async unbookmarkModelRegistryRaw(requestParameters: UnbookmarkModelRegistryRequest): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling unbookmarkModelRegistry.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling unbookmarkModelRegistry.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{name}/unbookmark`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Unbookmark registry model
     */
    async unbookmarkModelRegistry(requestParameters: UnbookmarkModelRegistryRequest): Promise<void> {
        await this.unbookmarkModelRegistryRaw(requestParameters);
    }

    /**
     * Update registry model
     */
    async updateModelRegistryRaw(requestParameters: UpdateModelRegistryRequest): Promise<runtime.ApiResponse<V1ModelRegistry>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling updateModelRegistry.');
        }

        if (requestParameters.modelName === null || requestParameters.modelName === undefined) {
            throw new runtime.RequiredError('modelName','Required parameter requestParameters.modelName was null or undefined when calling updateModelRegistry.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateModelRegistry.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{model.name}`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"model.name"}}`, encodeURIComponent(String(requestParameters.modelName))),
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: V1ModelRegistryToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ModelRegistryFromJSON(jsonValue));
    }

    /**
     * Update registry model
     */
    async updateModelRegistry(requestParameters: UpdateModelRegistryRequest): Promise<V1ModelRegistry> {
        const response = await this.updateModelRegistryRaw(requestParameters);
        return await response.value();
    }

    /**
     * Update registry model settings
     */
    async updateModelRegistrySettingsRaw(requestParameters: UpdateModelRegistrySettingsRequest): Promise<runtime.ApiResponse<V1ModelRegistrySettings>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling updateModelRegistrySettings.');
        }

        if (requestParameters.model === null || requestParameters.model === undefined) {
            throw new runtime.RequiredError('model','Required parameter requestParameters.model was null or undefined when calling updateModelRegistrySettings.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateModelRegistrySettings.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{model}/settings`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"model"}}`, encodeURIComponent(String(requestParameters.model))),
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: V1ModelRegistrySettingsToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ModelRegistrySettingsFromJSON(jsonValue));
    }

    /**
     * Update registry model settings
     */
    async updateModelRegistrySettings(requestParameters: UpdateModelRegistrySettingsRequest): Promise<V1ModelRegistrySettings> {
        const response = await this.updateModelRegistrySettingsRaw(requestParameters);
        return await response.value();
    }

    /**
     * Update model version
     */
    async updateModelVersionRaw(requestParameters: UpdateModelVersionRequest): Promise<runtime.ApiResponse<V1ModelVersion>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling updateModelVersion.');
        }

        if (requestParameters.model === null || requestParameters.model === undefined) {
            throw new runtime.RequiredError('model','Required parameter requestParameters.model was null or undefined when calling updateModelVersion.');
        }

        if (requestParameters.versionName === null || requestParameters.versionName === undefined) {
            throw new runtime.RequiredError('versionName','Required parameter requestParameters.versionName was null or undefined when calling updateModelVersion.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateModelVersion.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/registry/{model}/versions/{version.name}`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"model"}}`, encodeURIComponent(String(requestParameters.model))).replace(`{${"version.name"}}`, encodeURIComponent(String(requestParameters.versionName))),
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: V1ModelVersionToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ModelVersionFromJSON(jsonValue));
    }

    /**
     * Update model version
     */
    async updateModelVersion(requestParameters: UpdateModelVersionRequest): Promise<V1ModelVersion> {
        const response = await this.updateModelVersionRaw(requestParameters);
        return await response.value();
    }

}
